
<template>
  <div>
    <tableComponents :pagination="{currentPage,pageSize:pagesize,total:platoon_list.all_num}" @handleCurrentChange="handleCurrentChange"
        @handleSizeChange="handleSizeChange" @sendUserSearch="receive_search" :searchData="userSearchData" :isHaveExport="false" :isHaveAdd="false">
      <template v-slot:table>
        <el-table ref="multipleTable" :data="platoon_list.data" v-loading="loading" element-loading-text="拼命加载中" stripe
            header-row-class-name="head_color" tooltip-effect="dark" style="width: 99.8%">
          <el-table-column label="头像" min-width="80">
            <template slot-scope="scope">
              <div class="img_bor_tx">
                <img :src="$fnc.getImgUrl(scope.row.avatar)" alt />
              </div>
            </template>
          </el-table-column>
          <el-table-column label="用户信息" min-width="190">
            <template slot-scope="scope">
              <div class="tab_div">
                <div>
                  <span>用户账号：</span>
                  <span>{{scope.row.username || '----'}}</span>
                </div>
                <div>
                  <span>用户昵称：</span>
                  <span>{{scope.row.nickname || '----'}}</span>
                </div>
              </div>
            </template>
          </el-table-column>

          <el-table-column label="公排信息" min-width="200">
            <template slot-scope="scope">
              <div class="tab_div">
                <div>
                  <span>点位：</span>
                  <span>{{scope.row.oid}}</span>
                </div>
                <div>
                  <span>层数：</span>
                  <span>{{scope.row.level}}</span>
                </div>
                <div>
                  <span>下级点位：</span>
                  <span>{{scope.row.number}}</span>
                </div>
              </div>
            </template>
          </el-table-column>
          <el-table-column label="累计收益" min-width="190">
            <template slot-scope="scope">
              <div class="tab_div">
                <div>
                  <span>累计收益：</span>
                  <span>{{scope.row.income || '----'}}</span>
                </div>
              </div>
            </template>
          </el-table-column>
          <el-table-column label="入点位时间" min-width="200">
            <template slot-scope="scope">{{scope.row.created_time |getTimeFormat }}</template>
          </el-table-column>

          <el-table-column label="操作" min-width="150">
            <template slot-scope="scope">
              <el-button :loading="$store.state.isLoading" size="mini" type="primary"
                  @click="$router.push({path:'/index/page/platoon_detail',query:{id:scope.row.id}})">查看</el-button>
            </template>
          </el-table-column>
        </el-table>
      </template>
    </tableComponents>
  </div>
</template>
<script>
import { platoonIndexSearchData } from "@/assets/js/searchData/searchData"; //引入搜索的数据
export default {
  name: "platoon_index",
  data () {
    return {
      userSearchData: platoonIndexSearchData,
      multipleSelection: [],
      platoon_list: {
        data: []
      },
      loading: false,
      currentPage: 1, //初始页
      pagesize: 10, //    每页的数据
      serarch_from: {},
      formLabelWidth: "120px"
    };
  },

  created () {
    this.get_platoon_list();
  },
  methods: {
    show_platoon (id) { },

    receive_search (form) {
      this.serarch_from = form;
      this.get_platoon_list(form);
    },
    get_platoon_list (data) {
      this.loading = true;
      var params = {};
      data = data || {};
      params = data;
      this.$api.getPage.get_platoonlist(params).then(res => {
        if (res.data.code == 200) {
          this.platoon_list = res.data.result;
          this.loading = false;
        } else {
          this.$fnc.alerterror(res.data.result);
          this.loading = false;
        }
      });
    },
    // 初始页currentPage、初始每页数据数pagesize和数据data
    handleSizeChange: function (size) {
      //每页下拉显示数据
      var params = this.serarch_from;
      params.page = "1";
      params.page_size = size;
      this.get_platoon_list(params);
      this.pageSize = size;
    },
    handleCurrentChange: function (currentPage) {
      this.currentPage = parseInt(currentPage);
      var params = this.serarch_from;
      params.page = currentPage;
      params.page_size = this.pageSize;
      this.get_platoon_list(params);
    }
  }
};
</script>
<style scoped>
</style>
